import { IPSAppView } from '../../app/view/ipsapp-view';
import { IPSNavigateContext } from '../ipsnavigate-context';
import { IPSNavigateParam } from '../ipsnavigate-param';
import { IPSDETreeNodeRV } from './ipsdetree-node-rv';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDETreeNodeRVImpl extends PSModelObjectImpl implements IPSDETreeNodeRV {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected psnavigatecontexts: IPSNavigateContext[] | null = null;

  getPSNavigateContexts(): IPSNavigateContext[] | null {
    if (this.psnavigatecontexts == null) {
      this.psnavigatecontexts = this.fillChildListModel(this.M.getPSNavigateContexts, 'control.IPSNavigateContext') as IPSNavigateContext[];
    }
    return this.psnavigatecontexts;
  }

  get psNavigateContexts(): IPSNavigateContext[] | null {
    return this.getPSNavigateContexts();
  }

  findPSNavigateContext(objKey: any): IPSNavigateContext | null {
    return this.getPSModel5('control.IPSNavigateContext', this.getPSNavigateContexts(), objKey) as IPSNavigateContext;
  }

  protected psnavigateparams: IPSNavigateParam[] | null = null;

  getPSNavigateParams(): IPSNavigateParam[] | null {
    if (this.psnavigateparams == null) {
      this.psnavigateparams = this.fillChildListModel(this.M.getPSNavigateParams, 'control.IPSNavigateParam') as IPSNavigateParam[];
    }
    return this.psnavigateparams;
  }

  get psNavigateParams(): IPSNavigateParam[] | null {
    return this.getPSNavigateParams();
  }

  findPSNavigateParam(objKey: any): IPSNavigateParam | null {
    return this.getPSModel5('control.IPSNavigateParam', this.getPSNavigateParams(), objKey) as IPSNavigateParam;
  }

  protected refpsappview: IPSAppView | null = null;

  getRefPSAppView(): IPSAppView | null {
    if (this.refpsappview != null) return this.refpsappview;
    const value = this.M.getRefPSAppView;
    if (value == null) {
      return null;
    }
    this.refpsappview = this.getPSModel4('app.view.IPSAppView', value, 'getRefPSAppView') as IPSAppView;
    return this.refpsappview;
  }

  get refPSAppView(): IPSAppView | null {
    return this.getRefPSAppView();
  }

  getRefPSAppViewMust(): IPSAppView {
    const value = this.getRefPSAppView();
    if (value == null) {
      throw new Error('未指定引用视图');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSDETreeNodeRVImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.IPSNavigateParamContainer' || cls == 'control.tree.IPSDETreeNodeRV') return true;
    return super.instanceof(cls);
  }
}
